package com.cat;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

import java.net.InetAddress;

@SpringBootApplication
@MapperScan("com.cat.mapper")
@Slf4j
public class CatServiceApplication {

//    public static void main(String[] args) {
//        SpringApplication.run(CatServiceApplication.class, args);
//        log.info("项目已启动。。。");
//    }
@SneakyThrows
public static void main(String[] args) {
    SpringApplication app=new SpringApplication(CatServiceApplication.class);
    ConfigurableApplicationContext application=app.run(args);
    //ConfigurableApplicationContext application=SpringApplication.run(Knife4jSpringBootDemoApplication.class, args);
    Environment env = application.getEnvironment();
    log.info("\n----------------------------------------------------------\n\t" +
                    "Application '{}' is running! Access URLs:\n\t" +
                    "Local: \t\thttp://localhost:{}/api/admin\n\t" +
                    "External: \thttp://{}:{}/api/admin\n\t"+
                    "Doc: \thttp://{}:{}/api/admin/doc.html\n"+
                    "----------------------------------------------------------",
            env.getProperty("spring.application.name"),
            env.getProperty("server.port"),
            InetAddress.getLocalHost().getHostAddress(),
            env.getProperty("server.port"),
            InetAddress.getLocalHost().getHostAddress(),
            env.getProperty("server.port"));
}

}
